package April._25.homework.work5;

import untils.TestFlag;

import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Scanner;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Server {
    public static void main(String[] args) throws IOException {
        //创建套接字serverSocket
        ServerSocket serverSocket = new ServerSocket(9999);
        //发送、刷新
        boolean flag=true;
        //创建线程池
        ExecutorService threadPool = Executors.newFixedThreadPool(2);
        while(flag){
            //连接，获取socket
            Socket socket = serverSocket.accept();

            if(TestFlag.testFlag){
                System.out.println("启动Robot线程");
            }
            threadPool.submit(new RobatTask(socket));



/*            String msg = scanner.nextLine();
            outputStreamWriter.write(msg);
            outputStreamWriter.flush();*/
        }
    }
}
